home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 April / macformat-023.iso / Shareware City / Developers / NeoPersist 3.0.8 folder / NeoIncludes / CNeoMetaClass.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.8 KB  |  78 lines  |  [TEXT/MMCC]

  1. /****
  2.  * CNeoMetaClass.h
  3.  *
  4.  *    Methods for the metaclass class.
  5.  *
  6.  *    Copyright © 1992-1994 NeoLogic Systems.    All rights reserved.
  7.  *
  8.  ****/
  9. #pragma once            /* Include this file only once */
  10. #ifndef __CNeoMetaClass__
  11. #define __CNeoMetaClass__ 1
  12.  
  13. #include "NeoTypes.h"
  14.  
  15. class CNeoPersist;
  16.  
  17. #if defined(qNeoPersist) && !defined(qNeoPersistPlusPlus)
  18. enum {kNeoClasses        = 25};    // Total number of persistent classes in the application. NeoAccess uses 20 of these internally.
  19. #else
  20. enum {kNeoClasses        = 100};    // Total number of persistent classes in the application. NeoAccess uses 20 of these internally.
  21. #endif
  22. typedef CNeoMetaClass *    NeoMetaTable[kNeoClasses];
  23.  
  24.                         // "method" for creating an object of this class
  25. typedef CNeoPersist *    NeoGetOne(void);
  26.  
  27. typedef void *            NeoKeyManager(const NeoKeyOp aOp, ...);
  28.  
  29. class CNeoMetaClass
  30. {
  31. public:
  32.                         /** Instance Methods **/
  33.                         CNeoMetaClass(const NeoID aID, const NeoID aSuper, const CNeoString &aName, NeoGetOne aGetOne = nil, NeoKeyManager aKeyManager = nil);
  34.     virtual                ~CNeoMetaClass(void);
  35.  
  36.                         /** Class Methods **/
  37.     static void            AddMetaClass(CNeoMetaClass *aMetaClass);
  38.     static CNeoMetaClass *
  39.                         FindByName(const CNeoString &aName);
  40.     static CNeoMetaClass *
  41.                         GetMetaClass(const NeoID aClassID);
  42.     NeoID                getID(void) const {return fID;}
  43.  
  44.                         /** Access Methods **/
  45.     NeoID                getIndexBase(const short aIndex) const {return fIndexBase[aIndex];}
  46.     NeoID                getIndexClass(const short aIndex) const {return fIndexClass[aIndex];}
  47.     void                getIndexClasses(NeoID *aClasses) const;
  48.     void                getName(CNeoString &aName) const {aName = fName;}
  49.     char *                getNamePtr(void) const;
  50.     NeoID                getSuperID(const short aIndex) const;
  51.     short                getSuperCount(void) const {return fSuperCount;}
  52.     void                setGetOne(NeoGetOne aMethod) {getOne = aMethod;}
  53.     void                setKeyManager(NeoKeyManager aMethod);
  54.     void                setSuperclass(const NeoID aClassID);
  55. #ifdef qPPCC
  56.     NeoGetOne            *getOne;                    // "method" for creating an object of this class
  57.     NeoKeyManager        *keyManager;                // "method" for managing selection criteria for index classes
  58. #else
  59.     NeoGetOne            (*getOne);                    // "method" for creating an object of this class
  60.     NeoKeyManager        (*keyManager);                // "method" for managing selection criteria for index classes
  61. #endif
  62.  
  63. protected:
  64.     short                fIndexCount;                // number of indexes this class has
  65.     short                fSuperCount;                // number of superclasses this class has
  66.     NeoID                fID;                        // class id of this class
  67.     NeoID                fSuperID[kNeoMaxSuper];        // class IDs of this class's super classes
  68.     CNeoString            fName;                        // name of this class
  69.     NeoID                fIndexClass[kNeoMaxIndice];    // array of index classes
  70.     NeoID                fIndexBase[kNeoMaxIndice];    // root class which index is to be attached to
  71.  
  72. public:
  73.     static NeoID        FSysClassID;
  74.     static NeoID        FObjClassID;
  75.     static NeoMetaTable    FMetaClass;
  76. };
  77. #endif
  78.